<template>
  <el-container class="h-[100%]">
    <el-aside width="280px">
      <el-menu
        router
        :default-active="activeUrl"
        class="el-menu-vertical-demo h-[100%]"
        background-color="#545c64"
        text-color="#fff"
        active-text-color="#ffd04b"
      >
        <GMenuItem v-for="(item, index) in menu" :key="index" :item="item" />
      </el-menu>
    </el-aside>
    <el-container>
      <el-header class="flex justify-between items-center">
        <g-bread-crumb />
        <g-drop-down :items="dropList" @command="doCommand"/>
      </el-header>
      <el-main>
        <router-view />
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import { mapState } from 'vuex'
import GDropDown from '@/components/GDropDown.vue'
export default {
  name: 'layout',
  components: { GDropDown },
  data () {
    return {
      dropList: [
        { title: '退出', attrs: { command: 'logout', divided: true } },
        { title: 'VIP', attrs: { disabled: true, divided: true } }
      ]
    }
  },
  computed: {
    ...mapState('user', ['menu', 'activeUrl'])
  },
  methods: {
    doCommand (c) {
      console.log('doCommand', c)
    }
  },
  mounted () {
    // console.log('mapState', this.activeUrl)
  }
}
</script>

<style scoped>
.el-header {
  background-color: #b3c0d1;
}

.el-aside {
  background-color: #d3dce6;
}

.el-main {
  background-color: #e9eef3;
}
</style>
